###########################################################################
# Marc S. Jacob
# Citizen Support for Democracy, Anti-pluralist Parties in Power,
# and Democratic Backsliding
# European Journal of Political Research
# README 
###########################################################################

TABLE OF CONTENTS

META CODE:

1. "main.R": meta code to reproduce all results

CODE:

2. "01_setup.R": installing packages and setting figure theme
3. "02_function.R": function for marginal effects plot
4. "03_party_systems.R": Preparing party system data
5. "04_citizen_support.R": Estimate citizen support from public opinion data
6: "05_merging.R": merge citizen, party, and institutional variables for analysis

7. "tab_1.R": Table 1
8. "tab_2.R": Table 2
9. "tab_3.R": Table 3

10. "fig_1.R": Figure 1
11. "fig_2.R": Figure 2

12. "tab_c1.R": Table C.1
13. "tab_d1.R": Table D.1
14. "tab_e1.R": Table E.1
15. "tab_e2.R": Table E.2
16. "tab_e3.R": Table E.3
17. "tab_e4.R": Table E.4
18. "tab_e5.R": Table E.5
19. "tab_e6.R": Table E.6
20. "tab_e6.R": Table E.7
21. "tab_f1.R": Table F.1


22. "fig_a1.R": Figure A.1
23. "fig_a2.R": Figure A.2
24. "fig_a3.R": Figure A.3
25. "fig_a4.R": Figure A.4
26. "fig_b1.R": Figure B.1
27. "fig_c1.R": Figure C.1
28. "fig_d1.R": Figure D.1
29. "fig_e1.R": Figure E.1
30. "fig_e2.R": Figure E.2
31. "fig_e3.R": Figure E.3
32. "fig_e4.R": Figure E.4
33. "fig_e5.R": Figure E.5
34. "fig_e6.R": Figure E.6
35. "fig_e7.R": Figure E.7
36. "fig_e8.R": Figure E.8
37. "fig_e9.R": Figure E.9
38. "fig_e10.R": Figure E.10
39. "fig_f1.R": Figure F.1

DATA: 

40. "survey_data.rda": Survey data; ‘Cassandra’ Tai, Y., Hu, Y. U., & Solt, F. (2022). Democracy, Public Support, and Measurement Uncertainty. American Political Science Review, https://doi.org/10.1017/S0003055422000429, link to dataset used for analysis: https://dataverse.harvard.edu/file.xhtml?fileId=6054916&version=1.0
41. "vparty_subset.rda": Subset of V-Party data (v2); Lindberg, Staffan I.; Düpont, Nils; Higashijima, Masaaki; Kavasoglu, Yaman Berker; Marquardt, Kyle L.; Bernhard, Michael et al. (2022): Codebook Varieties of Party Identity and Organization (V–Party) V2.
42. "vdem_v13_subset.rda": Subset of V-Dem data (v13); Coppedge, Michael; Gerring, John; Knutsen, Carl Henrik; Lindberg, Staffan I.; Teorell, Jan; Altman, David et al. (2023): V-Dem [Country-Year/Country-Date] Dataset v13.
43. "democratic_stock.rda": Democratic stock data; Edgell, A. B., Wilson, M. C., Boese, V. A., & Grahn, S. (2020). Democratic Legacies: Using Democratic Stock to Assess Norms, Growth, and Regime Trajectories. V-Dem Working Paper, 100.
44. "api_data.csv": Affective polarization data; Orhan, Y. E. (2022). The relationship between affective polarization and democratic backsliding: comparative evidence. Democratization, 29(4), 714–735; link to dataset: https://dataverse.harvard.edu/file.xhtml?fileId=6078601&version=1.0

STAN MODELS:

45. "supdem.stan.mod5.stan": Stan model (Claassen Model 5); Claassen, C. (2019). Estimating Smooth Country–Year Panels of Public Opinion. Political Analysis, 27(1), 1–20.
46. "supdem.stan.mod6.stan": Stan model (Claassen Model 6); Claassen, C. (2019). Estimating Smooth Country–Year Panels of Public Opinion. Political Analysis, 27(1), 1–20.

MODEL OUTPUT:

47: "claassen_mod5_mean_estimates.rda": Claassen Model 5 mean estimates obtained from "04_citizen_support.R"
48. "claassen_mod5_draw_estimates.rda": Claassen Model 5 draw estimates obtained from "04_citizen_support.R"
49. "claassen_mod6_mean_estimates.rda": Claassen Model 6 mean estimates obtained from "04_citizen_support.R" 

R PROJECT ENVIRONMENT:

50. "2023_EJPR_rep.Rproj": R project environment to set working directory

FIGURE FONT

51. "lmroman10-regular-webfont.ttf": Font file

README:

52. "README.txt": This README file

SESSION INFO:

R version 4.4.0 (2024-04-24 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 22631)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.utf8  LC_CTYPE=English_United States.utf8   
[3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.utf8    

time zone: America/Los_Angeles
tzcode source: internal

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] showtext_0.9-7     showtextdb_3.0     sysfonts_0.8.9     hablar_0.3.2       ggrepel_0.9.5     
 [6] rstan_2.32.6       StanHeaders_2.32.7 interflex_1.2.6    stargazer_5.2.3    ggpubr_0.6.0      
[11] plm_2.6-4          scales_1.3.0       effectsize_0.8.7   lubridate_1.9.3    forcats_1.0.0     
[16] stringr_1.5.1      dplyr_1.1.4        purrr_1.0.2        readr_2.1.5        tidyr_1.3.1       
[21] tibble_3.2.1       ggplot2_3.5.1      tidyverse_2.0.0  